package cn.wp.ewallet.upms.dao.impl;

import cn.wp.common.core.dao.JdbcSupportTemplate;
import cn.wp.common.core.dao.SqlString;
import cn.wp.ewallet.upms.dao.LoginUserDooDao;
import cn.wp.ewallet.upms.model.entity.LoginUserDoo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ClassName SystemUserInfoDaoImpl
 * @Author ruixule
 * @Description TODO
 * @Date 2019/12/25 12:13
 */
@Repository
public class LoginUserDooDaoImpl implements LoginUserDooDao {

    @Autowired
    private JdbcSupportTemplate jdbcSupportTemplate;



    @Override
    public List<LoginUserDoo> selectLoginUserDooByName(String username) {
        SqlString sqlString=new SqlString();


        sqlString.add("SELECT a.*,c.post_id,c.post_name,d.staff_name ,d.phone,d.email  FROM system_user_info a,staff_post_rel b ,post_info c,staff_info d WHERE");
        sqlString.add("a.STATUS = ?  AND a.SYS_USER_CODE = ? AND a.staff_id =b.staff_id AND b.post_id = c.post_id AND d.staff_id= a.staff_id");
        Object[] params=new Object[]{
                "1000",
                username,
        };
        return jdbcSupportTemplate.selectList(sqlString.build(),params, LoginUserDoo.class);
    }
}
